import { defineConfig } from 'vitepress';
import { computerNetworkApplication, computerNetworkChoice, dataStructureTopics,computerOrganizationChoice, computerOrganizationApplication, osChoice, osApplication, highMath, highMathSidebar } from '../../map';

// 生成选择题考点链接
const generateSidebarItems = (topics, baseId) => {
  return topics.map((item, index) => ({
    text: item.text,
    link: `/data-structure/${baseId + index }`,
    // 可选：标记补充考点样式
    className: item.isSupplement ? 'supplement-topic' : ''
  }));
};


export default defineConfig({
    lang: 'zh-CN',
    
    title: '408 考研专业课笔记',
    description:
        '深入记录 408 考研专业课知识，涵盖数据结构、计算机组成原理、操作系统和计算机网络。',
    head: [
        ['link', { rel: 'icon', type: 'image/svg+xml', href: '../static/icon/title.svg' }],
        ['link', { rel: 'stylesheet', href: '../style/custom.css' }]
    ],
    themeConfig: {
      search: {
        provider: 'local'
      },
        nav: [
            { text: '学习',
              items: [
                { text: '408错题', link: '/about' },
                { text: '数学错题', link: '/faq' },
            ]
             },
            { text: '人生经历', link: '/life-experience/intro' },
            { text: '资源分享', link: '/resource-sharing/intro' },
            { text: '博客文章', link: '/blog/intro' },

            { text: '项目展示', link: '/projects/intro' },
            {
                text: '更多',
                items: [
                    { text: '关于我', link: '/about' },
                    { text: '常见问题', link: '/faq' },
                    { text: '联系我', link: '/contact' }
                ]
            }
        ],
        
        contentWidth: '1400px',
        sidebarWidth: '300px', 
        sidebar: [
            {
                text: '数据结构',
                collapsible: true,
                collapsed: true,
                items: [
                  {
                    text: '选择题（51考点）',
                    collapsible: true,
                    collapsed: false,
                    items: generateSidebarItems(dataStructureTopics.choice, 1)
                  },
                  
                  // 应用题分组（自动接续编号）
                  {
                    text: '应用题（9考点）',
                    collapsible: true,
                    collapsed: true,
                    items: generateSidebarItems(dataStructureTopics.application, 
                      dataStructureTopics.choice.length + 1)
                  }
                ]
            },
            {
                text: '计算机组成原理',
                collapsible: true,
                collapsed: true,
                items: [
                  {
                    text: '选择题（35考点）',
                    collapsible: true,
                    collapsed: true,
                    items: computerOrganizationChoice
                },
                {
                    text: '应用题（8考点）',
                    collapsible: true,
                    collapsed: true,
                    items: computerOrganizationApplication
                }
                ]
            },
            {
                text: '操作系统',
                collapsible: true,
                collapsed: true,
                items: [
                  {
                    text: '选择题（30考点）',
                    collapsible: true,
                    collapsed: true,
                    items: osChoice
                },
                {
                    text: '应用题（8考点）',
                    collapsible: true,
                    collapsed: true,
                    items: osApplication
                }
                ]
            },
            {
                text: '计算机网络',
                collapsible: true,
                collapsed: true,
                items: [
                  {
                      text: '选择题（60考点）',
                      collapsible: true,
                      collapsed: true,
                      items: computerNetworkChoice
                  },
                  {
                      text: '应用题（7考点）',
                      collapsible: true,
                      collapsed: true,
                      items: computerNetworkApplication
                  }
              ]
            },
            {
              text: '高等数学二',
              collapsible: true,
              collapsed: true,
              items: highMathSidebar[0].items // 适配侧边栏层级结构
            }
        ],
        sidebarStyle: {
            collapsedWidth: '150px',
            group: {
                activeBg: '#e8f6e8',
                activeTextColor: '#8FBC8F',
                textColor: '#333',
                hoverBg: '#f0f0f0'
            },
            item: {
                padding: '10px 100px',
                fontSize: '18px',
                textColor: '#666'
            },
            collapseTransition: true,
            transitionDuration: '0.3s'
        },
        footer: {
            message: '版权所有 &copy; 2025 汪金钰',
            copyright: '保留所有权利'
        }
    }
});    